#ifndef PERSON_H
#define PERSON_H

#include <QString>
#include <string>

using namespace std;

enum Gender{
    MALE =0 ,
    FEMALE = 1
};

class Person
{
public:
    Person(QString name, int age, QString location, Gender gender);
    Person();

    friend ostream& operator <<(ostream &os, Person &p);
    friend istream& operator >>(istream &is, Person &p);

    virtual void outPut2Console();
    int getId(){return _id;}
    QString getName(){return _name;}
    QString getLocation(){return _location;}
    int getAge(){return _age;}
    Gender getGender(){return _gender;}

    //auxilarry methods
      static QString getInfoFromIstream(istream &is);
      static const QString GenderStr[2];

protected:

    int _id;
    QString _name;
    int _age;
    QString _location;
    Gender _gender;



    //test
public:
    void save();
    void load();
};

class ID{
public:
    static int getID(){
        if(!theID){
            theID = new ID();
        }
        return ++(theID->_id);
    }

private:
    ID(){
        _id = 0;
    }


    int _id;
    static ID *theID;


};

#endif // PERSON_H
